#include "senar.h"

int strlen(char *kata){
	int i=0;
	while (kata[i] != '\0') i++;
	return i;
}

void strcat(char *kata1, char *kata2){
	int c,i=0;
	c=strlen(kata1);
	while (kata2[i] != '\0') {
		kata1[c+i] = kata2[i];
		i++;
	}
	kata1[c+i] = '\0';
}

void strcpy(char *kata1, char *kata2, int awl, int pjg){
	int i;
	for(i=0;i<pjg;i++) kata1[i]=kata2[i+awl];
	kata1[i] = '\0';
}

int strcmp(char *kata1, char *kata2) {
	int i=0;
	while ((kata1[i]==kata2[i])&&(kata1[i]!='\0')) i++;
	if (kata1[i]==kata2[i]) return 0; else return (kata1[i]<kata2[i])?-1:1;
}

int strpos(char *kata1, char *kata2) {
	int i,j,k,len=strlen(kata2);
	for (i=0;i<strlen(kata1);i++) {
		j=0;
		while((j<len)&&(kata1[i+j]==kata2[j])) j++;
		if (j==len) return i;
	}
	return -1;
}
